var table_field = null;
var table_view = null;
table_field = [
/********************************************************BIM在现场,车管家用户表*******************************************************/
    {
        tablename: "user",//用户表
        fields: {
            z_id: { des: "z_id", type: "INT(11) PRIMARY KEY AUTO_INCREMENT" },
            id: { des: "账号", type: "varchar(30) UNIQUE" },
            name: { des: "昵称", type: "varchar(30)" },
            roleid: { des: "角色", type: "varchar(10)" },
            car_roleid: { des: "车管家角色", type: "varchar(10)" },
            pass: { des: "密码", type: "varchar(32)" },
            pic: { des: "头像", type: "varchar(260)" },
            fid: { des: "描述", type: "varchar(20)" },
            car_role: { des: '车管家角色', type: "varchar(20)" },
            sex: { des: "性别", type: "varchar(5)" },
            city: { des: "城市", type: "varchar(20)" },
            driver_pic: { des: "司机头像", type: "varchar(150)" },
            age: { des: "年龄", type: "varchar(5)" },
            wage: { des: "工作", type: "varchar(10)" },
            work_time: { des: "工作时间", type: "varchar(100)" },
            car_statue: { des: "是否绑定车", type: "varchar(10)" },
            //BIM在现场表移植
            clientname: { des: "客户名称", type: "varchar(20)" },
            ifuse: { des: "如果启动", type: "varchar(20)" },
            timefrom: { des: "开始时间", type: "varchar(20)" },
            tele: { des: "电话", type: "varchar(20)" },
            wx_openid: { des: "微信openid", type: "varchar(20)" },
            warn_grade: { des: "报警等级", type: "varchar(20)" },
        }
    },
/********************************************************BIM在现场表*******************************************************/
     {
         tablename: "budget",//预算表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "载体名称", type: "varchar(20)" },
             projectid: { des: "项目id", type: "int" },
             design_num: { des: "设计值", type: "int" },
             actural_num: { des: "实际用量值", type: "int" },
             equ_num: { des: "换算值", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "charts",//图表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             type: { des: "图表类型", type: "varchar(20)" },
             field: { des: "图表字段", type: "varchar(20)" },
             name: { des: "方案名称", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "device",//设备表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             clientname: { des: "客户名称", type: "varchar(20)" },
             devicename: { des: "设备名称", type: "varchar(20) UNIQUE" },
             type: { des: "设备类型", type: "varchar(20)" },
             deviceid: { des: "设备号", type: "bigint UNIQUE" },
             port: { des: "端口号", type: "int(11)" },
             zone: { des: "地区", type: "varchar(20)" },
             pos: { des: "位置", type: "varchar(20)" },
             status: { des: "状态", type: "varchar(20)" },
             groupid: { des: "设备组id", type: "bigint" },
             projectid: { des: "项目id", type: "bigint" },
             para_query: { des: "下发查询", type: "varchar(20)" },
             para_set: { des: "下发设置参数", type: "varchar(20)" },
             para_control: { des: "控制参数", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "device_parameters",//设备配置参数表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             key1: { des: "参数值", type: "varchar(20)" },
             value1: { des: "参数名称", type: "varchar(20)" },
             pro_type: { des: "端口号", type: "varchar(20)" },
             type: { des: "设备参数类型", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "group1",//设备组表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "设备组名", type: "varchar(20)" },
             projectid: { des: "项目id", type: "bigint(8)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "inventory",//存货表
         fields: {
             code: { des: "仓库代码", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             downtime: { des: "下发时间", type: "varchar(20)" },
             busicode: { des: "业务操作", type: "varchar(20)" },
             company_id: { des: "货主编号", type: "varchar(20)" },
             company_name: { des: "货主名称", type: "varchar(20)" },
             item_code: { des: "货品编码", type: "varchar(20)" },
             item_name: { des: "货品名称", type: "varchar(20)" },
             qty: { des: "库存数量", type: "bigint(8)" },
             y_qty: { des: "液位计库存", type: "bigint(8)" },
             l_qty: { des: "流量计库存", type: "bigint(8)" },
             unit: { des: "项目id", type: "varchar(20)" },
             type: { des: "项目id", type: "varchar(20)" },
             engine_no: { des: "项目id", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "log",//日志表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             projectid: { des: "项目id", type: "bigint(8)" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             name: { des: "值名称", type: "varchar(20)" },
             value: { des: "值", type: "varchar(20)" },
             temp: { des: "温度", type: "varchar(20)" },
             press: { des: "压力", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             press_unit: { des: "压力单位", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "log_8053",//8053日志表
         fields: {
             id: { des: "id", type: "bigint(11) PRIMARY KEY AUTO_INCREMENT" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             projectid: { des: "项目id", type: "varchar(20)" },
             devicestatus: { des: "设备状态", type: "tinyint(2)" },
             deviceerror: { des: "设备故障", type: "tinyint(2)" },
             gcjs1: { des: "过程警示1", type: "tinyint(2)" },
             gcjs2: { des: "过程警示1", type: "tinyint(2)" },
             cell: { des: "电池电量", type: "tinyint(2)" },
             memo: { des: "备用字段", type: "tinyint(2)" },
             value1: { des: "过程测量值1-浇筑深度", type: "float(4)", chart: "line" },
             value2: { des: "过程测量值2-探测孔深", type: "float(4)", chart: "line" },
             value3: { des: "过程测量值3-预留", type: "float(4)" },
             time: { des: "时间", type: "timestamp" },
             groupid: { des: "设备组id", type: "varchar(8)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "log_8054",//8054日志表
         fields: {
             id: { des: "id", type: "bigint(11) PRIMARY KEY AUTO_INCREMENT" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             projectid: { des: "项目id", type: "varchar(20)" },
             groupid: { des: "设备组id", type: "varchar(8)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "logfile",//日志文件表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             info_func: { des: "信息值", type: "varchar(20)" },
             info_name: { des: "信息名称", type: "varchar(20)" },
             name: { des: "日志名称", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             ip: { des: "ip", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "logwork",//日志3表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             projectid: { des: "项目id", type: "bigint" },
             title: { des: "日志标题", type: "varchar(50)" },
             des: { des: "日志描述", type: "varchar(100)" },
             content: { des: "日志内容", type: "varchar(100)" },
             file_url: { des: "日志文件路径", type: "varchar(260)" },
             submit_user: { des: "提交日志人", type: "varchar(20)" },
             statue: { des: "日志状态", type: "varchar(10)" },
             time: { des: "时间", type: "timestamp" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "project",//项目表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "项目名称", type: "varchar(50) UNIQUE" },
             description: { des: "项目描述", type: "varchar(100)" },
             type: { des: "项目类型", type: "varchar(20)" },
             clientname: { des: "用户名称", type: "varchar(50)" },
             num: { des: "项目编号", type: "varchar(20)" },
             project_num: { des: "项目数量", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             content: { des: "项目内容", type: "varchar(100)" },
             statue: { des: "项目状态", type: "varchar(20)" },
             busicode: { des: "业务操作", type: "varchar(20)" },
             status: { des: "状态", type: "varchar(20)" },
             x_pos: { des: "x坐标", type: "int(11)" },
             y_pos: { des: "y坐标", type: "int(11)" },
             country: { des: "国家", type: "varchar(20)" },
             province: { des: "省", type: "varchar(20)" },
             city: { des: "市", type: "varchar(20)" },
             postcode: { des: "邮编", type: "varchar(20)" },
             address: { des: "地址", type: "varchar(20)" },
             code: { des: "code", type: "varchar(20)" },
             des: { des: "描述信息", type: "varchar(100)" },
             downtime: { des: "下发时间", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "three_modal",//三维模型
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "模型名称", type: "varchar(50)" },
             file_url: { des: "模型原路径", type: "varchar(260)" },
             json_url: { des: "模型JSON路径", type: "varchar(260)" },
             projectid: { des: "项目id", type: "bigint" },
             type: { des: "模型类型", type: "int(4)" },
             size: { des: "模型大小", type: "varchar(100)" },
             typename: { des: "文件类型名称", type: "varchar(50)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "project_detail",//项目详情
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             oiltype: { des: "油品类型", type: "varchar(20)" },
             level: { des: "当前液位", type: "varchar(20)" },
             temp: { des: "平均温度", type: "varchar(20)" },
             density: { des: "当前密度", type: "varchar(20)" },
             volume: { des: "体积", type: "varchar(20)" },
             weight: { des: "质量", type: "varchar(20)" },
             height: { des: "油罐高度", type: "varchar(20)" },
             thermometer: { des: "温度计数据", type: "timestamp" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "protocol",//协议表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "协议名称", type: "varchar(20)" },
             port: { des: "端口号", type: "int(11)" },
             des: { des: "描述信息", type: "varchar(20)" },
             contentlen: { des: "内容长度", type: "varchar(20)" },
             cmd: { des: "cmd命令", type: "varchar(20)" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             headfields: { des: "头部字段", type: "varchar(20)" },
             crc: { des: "", type: "varchar(20)" },
             status: { des: "状态", type: "varchar(20)" },
             other: { des: "其他", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "role",//角色表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             name: { des: "角色名称", type: "varchar(50)" },
             des: { des: "描述信息", type: "varchar(100)" },
             power: { des: "权限", type: "TEXT" },
             ifuse: { des: "如果启动", type: "varchar(20)" },
             timeto: { des: "到期时间", type: "varchar(20)" },
             projectid: { des: "项目id", type: "bigint" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "warn_config",//报警配置表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             warn_type: { des: "1上限报警 2下限报警 3其他报警 4 等级报警", type: "int(20)" },
             notice_type: { des: "0 不通知 1 短信通知 2 公众号通知 3 都通知 4 转发post", type: "varchar(20)" },
             warn_grade: { des: "角色名称", type: "varchar(20)" },
             value: { des: "描述信息", type: "varchar(20)" },
             fieldname: { des: "字段名称", type: "varchar(20)" },
             postaddress: { des: "如果启动", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "category",//分类表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             type: { des: "类型", type: "varchar(20)" },
             parent: { des: "parent", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "yk_datasub",//分类表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             value: { des: "value", type: "varchar(20)" },
             time: { des: "时间", type: "datetime" },
             name: { des: "名称", type: "varchar(20)" },
             point_num: { des: "点数", type: "tinyint(20)" },
             dm: { des: "点数", type: "tinyint(20)" },
             sensor_num: { des: "传感器数量", type: "tinyint(20)" },
             data_len: { des: "数据长度", type: "tinyint(20)" },
             projectid: { des: "项目id", type: "varchar(20)" },
             pos: { des: "位置", type: "int(20)" },
             temp: { des: "温度", type: "varchar(20)" },
             flow: { des: "int", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     },
     {
         tablename: "warn_report",//报警report表
         fields: {
             id: { des: "id", type: "bigint PRIMARY KEY AUTO_INCREMENT" },
             deviceid: { des: "设备id", type: "varchar(20)" },
             time: { des: "时间", type: "timestamp" },
             warn_type: { des: "报警类型", type: "varchar(20)" },
             handle_status: { des: "处理状态", type: "varchar(20)" },
             projectid: { des: "项目id", type: "varchar(20)" },
             memo: { des: "int", type: "varchar(20)" },
             fieldname: { des: "那个字段触发的报警", type: "varchar(20)" },
             fid: { des: "父账号", type: "varchar(30)" }
         }
     }
/********************************************************BIM在现场视图*******************************************************/
];
table_view = [
    {
        tablename: "view_device_project",
        type: "left",
        table: {
            left: {
                name: "device",
                fields: "*"
            },
            right: {
                name: "project",
                fields: "name proname,code procode"
            }
        },
        where: "on a.projectid = b.id",
    },
     {
         tablename: "view_three_modal_project",
         type: "left",
         table: {
             left: {
                 name: "three_modal",
                 fields: "*"
             },
             right: {
                 name: "project",
                 fields: "name proname"
             }
         },
         where: "on a.projectid = b.id",
     },
     {
         tablename: "view_device_project_group1",
         type: "left",
         table: {
             left: {
                 name: "view_device_project",
                 fields: "*"
             },
             right: {
                 name: "group1",
                 fields: "name groupname"
             }
         },
         where: "on a.groupid = b.id",
     },
    {
        tablename: "view_role_user",
        type: "left",
        table: {
            left: {
                name: "user",
                fields: "*"
            },
            right: {
                name: "role",
                fields: "name rolename"
            }
        },
        where: "on a.roleid = b.id"
    },
    {
        tablename: "view_project_data_8053",
        type: "left",
        table: {
            left: {
                name: "log_8053",
                fields: "*"
            },
            right: {
                name: "project",
                fields: "name proname"
            }
        },
        where: "on a.projectid = b.id",
    },
     {
         tablename: "view_warnreport_project",
         type: "left",
         table: {
             left: {
                 name: "warn_report",
                 fields: "*"
             },
             right: {
                 name: "project",
                 fields: "name proname"
             }
         },
         where: "on a.projectid = b.id",
     },
    {
        tablename: "view_logwork_project",
        type: "left",
        table: {
            left: {
                name: "logwork",
                fields: "*"
            },
            right: {
                name: "project",
                fields: "name proname"
            }
        },
        where: "on a.projectid = b.id",
    },
    {
        tablename: "view_project_data_8051",
        type: "left",
        table: {
            left: {
                name: "log",
                fields: "*",
            },
            right: {
                name: "project",
                fields: "name proname"
            },
        },
        where: "on a.projectid = b.id",
    },
    {
        tablename: "view_budget_project",
        type: "left",
        table: {
            left: {
                name: "budget",
                fields: "*"
            },
            right: {
                name: "project",
                fields: "name proname"
            }
        },
        where: "on a.projectid = b.id"
    },
     {
         tablename: "view_log_8054_group1",
         type: "left",
         table: {
             left: {
                 name: "log_8054",
                 fields: "*"
             },
             right: {
                 name: "group1",
                 fields: "name groupname"
             }
         },
         where: "on a.groupid = b.id"
     },
     {
         tablename: "view_log_8053_group1",
         type: "left",
         table: {
             left: {
                 name: "log_8053",
                 fields: "*"
             },
             right: {
                 name: "group1",
                 fields: "name groupname"
             }
         },
         where: "on a.groupid = b.id"
     },
/********************************************************车管家视图*******************************************************/
     
];
//角色和用户
//项目和设备数据
exports.table_field = table_field;
exports.table_view = table_view;
